<template>
  <div class="subject-edit">
    <div class="editsubject clearfix">
      <div class="clearfix" style="margin-bottom: 32px">
        <div  class="colleft" style="padding-top: 9px" >专题名称:</div>
        <div  class="colright" ><input type="text" class="inputname" v-model="subjectData.subjectName" placeholder="专题名称" @input="checkname"></div>
      </div>
      <div class="clearfix" style="margin-bottom: 31px">
        <div  class="colleft" >轮播封面:</div>
        <div  class="colright " >
          <div class="imginput" @click="outDialog">
            <p>+</p>
            <p>添加图片</p>
            <img :src="subjectData.picUrl" alt="" >
          </div>
          <div class="pictip">
            <p>图文描述图片</p>
            <p>尺寸：379×190像素</p>
            <p>大小：200KB以下</p>
          </div>
        </div>
      </div>
      <div class="clearfix" style="margin-bottom: 31px">
        <div  class="colleft">专题详情介绍:</div>
        <div  class="colright" >
          <textarea contenteditable="true" class="textareainput" maxlength="400" placeholder="编辑专题详情介绍，介绍专题详情内容，200-400字数限制" v-model="subjectData.detailContent"></textarea>
        </div>
      </div>
      <div class="clearfix" >
        <div class="colleft" >专题随手拍提示文案:</div>
        <div  class="colright" >
          <textarea contenteditable="true" class="textareainput" maxlength="100" placeholder="引导用户参与随手拍专题，将随手拍通俗易懂解释给用户，50-100字数限制"  v-model="subjectData.hint"></textarea>
        </div>
      </div>
      <div class="saveorup">
        <Checkbox v-model="subjectData.isShelve" class="checkinput">保存后上架</Checkbox>
        <span class="savebt" @click="updateSubject">保存</span>
      </div>
    </div>
    <!--提示框-->
    <Modal class="warning-modal"
           v-model="showWarnModal"
           title="温馨提示"
           width="550"
           height="250"
    >
      <div class="warn-modal-body">
        <i class="modal-icon"></i>
        <p class="modal-content">{{warnContent}}</p>
      </div>
      <div slot="footer">
        <div class="warn-modal-footer">
          <span class="modal-close-btn" @click="closeModal">确定</span></div>
      </div>
    </Modal>
  </div>
</template>
<script>
  import index from  "./subject-edit.js"
  export default index ;
</script>
<style>
  .clearfix:after{content: '';display: block; clear: both}
  .subject-edit{
    padding: 20px 30px 0;
  }
  .editsubject{
    padding: 30px;
    border: 1px solid #DDDEE3;
    font-size: 14px;
    color: #AEAEAE;
    letter-spacing: 0;
    line-height: 22px;
  }
  .colleft{
    text-align: right;
    padding-right: 22px;
    width: 160px;
    float: left;
    color: #777E8C;
  }
  .colright{
    margin-left: 160px;
  }
  .inputname{
    padding: 8px 0 10px 10px;
    border: 1px solid #DDDEE3;
    border-radius: 2px;
  }
  .textareainput{
    padding: 11px 0 9px 10px;
    border: 1px solid #DDDEE3;
    border-radius: 2px;
    overflow-y: scroll;
    width: 100%;
    height: 80px;
    resize: vertical;
  }
  .imginput{
    width: 379px;
    height: 190px;
    padding-top: 66px;
    padding-bottom: 66px;
    text-align: center;
    background: #FFFFFF;
    border: 1px dashed #DDDEE3;
    display: inline-block;
    position: relative;
    background-color: #eee;
  }
  .imginput p:nth-child(1){
    font-size: 35px;
    padding-bottom: 8px;
  }
  .imginput img{
    position: absolute;
    top:50%;left: 50%;
    transform: translate(-50% ,-50%);
    -webkit-transform: translate(-50%, -50%);
    max-width: 100% ; max-height: 100% ;display: inline-block;
  }
  .pictip{
    display: inline-block;
    vertical-align: bottom;
    font-size: 12px;
    color: #AEAEAE;
    letter-spacing: 0;
    line-height: 18px;
    padding-left: 10px;
  }
  .saveorup{
    margin-top: 20px;
    float: right;
  }
  .saveorup .savebt{
    display: inline-block;
    background: #3F94FC;
    border-radius: 2px;
    font-size: 16px;
    color: #FFFFFF;
    letter-spacing: 0;
    line-height: 40px;
    padding-left: 59px;
    padding-right: 59px;
    cursor: pointer;
  }
  .checkinput{
    vertical-align: bottom;
    font-size: 14px;
    color: #2B3642;
  }
</style>
